Embedded devices are able to run specific task related functions to provide some fixed functionalities (e.g., RFID chips). Many high-end devices are able to download and execute external code in order to provide added functionality. Embedded devices may include, but are not limited to, consumer electronics, medical devices, vending machines, point of sale terminals and other devices. Functionalities may include the ability to process financial transactions, perform detailed calculations and human automation, among many other functions. Embedded devices may be allowed to execute code for performing these various functions. However, to ensure the code functions correctly, multiple runtime checks may need to be performed. Runtime checks are a mechanism to check for error conditions at execution time, in contrast to checks done by the programming language and compilers (called compile-time checks) which only check for syntactical and type-related errors. Some of the runtime checks occur at startup, wherein the program is terminated if an error is found during the checks (e.g., a missing dependency, lack of certain hardware, etc.). Other runtime checks occur during the application execution and generally, throw exceptions if a check fails. Many of the runtime checks could be done prior to starting the application execution.
Recent embedded devices have begun to use virtual machines (VM), like the ECMA 335 VM, in order to provide increased platform portability and a richer development environment for devices. The increased portability is possible because VM converts code into machine language and executes it and may create an environment between a computer platform and the end user (e.g., embedded device) in which the end user can operate software applications properly. During runtime the virtual machine and assembly code may be used together to run an application. A more rich development environment is inherited from all the software available on the personal computer to support the VM. While this may solve issues related to using embedded devices, it also introduces new problems as well including as adding VM specific requirements (e.g., multiple runtime checks) that may need to be performed on an embedded device with limited resources.
Performing runtime checking has been known to slow down performance and VM requires even more runtime checks than the traditional approach which uses native code. In performance critical applications, some of the runtime check may be switched off. The downside to this being that the application may not execute properly if a check fails during execution (e.g. crash or wrong results). In addition, to keep cost down, embedded devices often have very limited CPU power and very limited memory, and this may be a source of many problems. For example, smaller devices, such as PDA's and other hand held computing devices, while convenient, usually have less memory, disk space, and resources than a personal computer. During runtime, many checks on code are completed before execution begins, which means a large amount of code is required to implement the runtime check. However, this does not add visible functionality to the application. Additional processing time may also be needed to verify all the code cases. The quantity of checks can differ between different runtimes. Some runtime standards (e.g., ECMA-335 Common Language Infrastructure (CLI)) may be heavier on verification requirements than others (e.g., loading an assembly, verifying the metadata, etc.). This presents code size and time issues both of which may be limited resources on embedded devices. There is a need for providing embedded devices having limited resources with the efficient method for providing runtime checking without the disadvantages of slowing down performance.